<template>
  <div class="bigBox">
    <div class="top1">
      <el-button type="primary" color="rgb(66,139,202)" @click="add"><b>+新增</b></el-button>
      <el-input
        v-model="input"
        style="width: 40%; height: 5%"
        placeholder="关键字"
      ></el-input>
      <el-button-group>
        <el-button>搜索</el-button>
        <el-button style="width: 5%" @click="show1 = !show1"
          ><el-icon><ArrowDown /></el-icon
        ></el-button>
      </el-button-group>
      <el-button> 仓库管理 </el-button>
    </div>
    <div class="showtop" v-show="show1">
      <p>高级搜索</p>
      <p @click="dialogVisible = true">自定义列显示</p>
      <p>打印</p>
    </div>
    <el-dialog v-model="dialogVisible" width="300px" title="自定义列显示">
      <div class="dialog-content">
          <p v-for="(city,index) in columns" :key="city.key">
            <el-checkbox type="checkbox" v-model="che[index].feg"/> {{ city.label }}
            <br />
          </p>
      </div>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="cheAppshow"> 确定 </el-button>
          <el-button @click="dialogVisible = false">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>
    
<script setup lang='ts'>
import { ref, reactive, onMounted, onBeforeMount } from "vue";
import Axios from "axios";
import { ArrowDown } from "@element-plus/icons-vue";
const show1 = ref(false);
const input = ref("");

const dialogVisible = ref(false);
const setcolumn = reactive([]);
// 接收父组件参数
const props = defineProps({
  list: {
    type: Array,
    default: [],
  },
  columns: {
    type: Array,
    default: [],
  },
  childev:{
    type: Function,
    default: ()=>{}
  },
  add:{
    type: Function,
    default: ()=>{}
  }
});
const che = ref([])
onBeforeMount(()=>{
  cheshow()
})
const cheshow = ()=>{
  props.columns.forEach((item:any, index)=>{
    che.value.push({feg: item.feg, value: item.key})
  })
}
const cheAppshow = ()=>{
  props.childev(che.value)
}
</script>
    
<style scoped>
@import url(../style/zcss.css);
</style>